<!DOCTYPE html>
<html>
	<head>
		{% include 'zbook/common/header.html' %}
		<title>阅读</title>
	</head>
	<body>
		{% include 'zbook/common/topbar.html' %}
        <!--小说列表展示内容-->
        <div class="container">
        	<!--导航-->
			<!--推荐书籍-->
			{% include 'zbook/common/recommend.html' %}
        	<!--书籍内容-->
        	<div class="read-Fiction">
        		<div class="read-operating box">
        			<a href="/catalog?bid={{data.page.book_id}}" class="btn btn-success box-flex">章节</a>
        			<a href="/bookself" class="btn btn-default box-flex">书架</a>
        			<a href="javascript:void(0);" class="fontSizePlus btn btn-default box-flex">A+</a>
        			<a href="javascript:void(0);" class="fontReset btn btn-info box-flex">复位</a>
        			<a href="javascript:void(0);" class="fontSizeMinus btn btn-default box-flex">A-</a>
        			<a href="javascript:void(0);" class="openlamp btn btn-warning box-flex">关闭</a>
        			<a href="javascript:void(0);" class="closelamp btn btn-success box-flex">护眼</a>
        		</div>
        		<div class="article-title">第{{data.page.sort}}章 {{ data.page.title}}</div>
        		<div class="article-content">
        			{{ data.page.content.replace('\n', '<br>')|safe }}
        		</div>
        		<!---->
        		<div class="seesaw-article clearfix">
        			<a href="/read?bid={{data.page.book_id}}&pid={{data.pre_title.sort}}" class="seesaw-link">上一章： {{ data.pre_title.title }}</a>
        			<a href="/read?bid={{data.page.book_id}}&pid={{data.next_title.sort}}" class="seesaw-link">下一章：{{ data.next_title.title }}</a>
        		</div>
        	</div>
        </div>
		{% include 'zbook/common/footer.html' %}
	</body>
</html>
<script>
		/*****************文字放大缩小****************/

$(document).ready(function (){
	//最小字号
	var min=14;
	//最大字号
	var max=26;

	var reset = $('p').css('fontSize');

	var elm = $('.article-content');

	var size = str_replace(reset, 'px', '');

	//放大字体
	$('a.fontSizePlus').click(function() {
		if (size<=max) {
			//增加大小
			size++;
			//设定字体尺寸
			elm.css({'fontSize' : size,'line-height':size*2+"px"});
		}
		//取消一个单击事件
		return false;

	});

	$('a.fontSizeMinus').click(function() {
		//如果字体大小更大或比最小值相等
		if (size>=min) {
			//减少尺寸
			size--;
			//设定字体尺寸
			elm.css({'fontSize' : size,'line-height':size*2+"px"});
		}
		//取消一个单击事件
		return false;
	});
	$(".openlamp").on("click",function(){
		$('body').css({'background':'#ffffff','color':'#000000'})
		$('body').removeClass("Eye_protection");

	});
	$(".closelamp").on("click",function(){
		$('body').css({'background':'#fff9d8','color':'#333333'});
		$('body').addClass("Eye_protection");

	});
	//重置字体大小
	$('a.fontReset').click(function () {
		//设置默认字体大小
		 elm.css({'fontSize' : reset});
	});

});
//一个字符串替换函数
function str_replace(haystack, needle, replacement) {
	var temp = haystack.split(needle);
	return temp.join(replacement);
}
	var topnode = document.querySelector('#header-top');

	function change() {
		var bgheader = document.getElementById('integral-bgheader');
		var y = document.scrollingElement.scrollTop;
		bgheader.style.opacity = (((y / 50) > 0.9) ? 0.9 : (y / 50));
		if(y > 50) {
			topnode.classList.add("headerstyle");
		} else {
			topnode.classList.remove("headerstyle");
		}
	}
	document.addEventListener('touchmove', change);
	document.addEventListener('scroll', change);
	/**************搜索********************/
	function submit_search(){
		var name= $("#search-content").val();
		if(name!=''){
			window.location.href='/search?key='+name;
		}else{
			PromptBox('请输入查询信息!',2,false);
		}

	}

</script>